
import javax.servlet.http.*;
import java.sql.*;
import java.io.*;

public class StudentMarksServlet extends HttpServlet
{
  
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
  {

     try
       {
           
            response.setContentType("text/html");

         PrintWriter out=response.getWriter();
        
           String student_uname=request.getParameter("student_uname");
           String student_id=request.getParameter("student_id");
          
            String ssc=request.getParameter("ssc");
        String ssc_year=request.getParameter("ssc_year");
        String inter=request.getParameter("inter");
        String inter_year=request.getParameter("inter_year");
        String graduation=request.getParameter("graduation");
        String graduation_year=request.getParameter("graduation_year");
        String pg=request.getParameter("pg");
        String pg_year=request.getParameter("pg_year");
        String technical_skills=request.getParameter("technical_skills");
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","pac","mca"); 
   PreparedStatement pstmt3=con.prepareStatement("insert into student_marks values(?,?,?,?,?,?,?,?,?,?,?)");
        
         pstmt3.setString(1,ssc);
         pstmt3.setString(2,ssc_year);
         pstmt3.setString(3,inter);
         pstmt3.setString(4,inter_year);
         pstmt3.setString(5,graduation);
         pstmt3.setString(6,graduation_year);
         pstmt3.setString(7,pg);
         pstmt3.setString(8,pg_year);
         pstmt3.setString(9,student_id);
         pstmt3.setString(10,student_uname);
         pstmt3.setString(10,student_uname);
         pstmt3.setString(11,technical_skills);
         
        pstmt3.executeUpdate();            
        

         out.println("<html>");
     
         out.println("<body background=\"ds.jpg\">");
         out.println("<div><div style='float:left'>");
         out.println("<form action='index.html'>");
         out.println("<input type='submit' value='home'/></form></div>"); 
         out.println(" <font size=\"4\"> ");
         out.println("<form method='post' action='srs3'>");
         out.println("<table>");
         out.println("</table>");
         out.println("<br><br><br><br><br><center><font size='5'>");
          out.println(student_uname);
           out.println("<b><br>Registered Successfully</font> </b>");

         out.println("<br><br> <b> <a href='student-login.html'> <font color=\"blue\"> Click here </font> </a> to Login </b></center>");

         out.println("</font>");

         out.println("</body>");

         out.println("</html>");   

 }
 
    catch(Exception e)
       {
         response.sendError(505,e.getMessage());
         e.printStackTrace();
       }    

  }

}  

 